﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Article.aspx.cs" Inherits="ProjectSem40701.Admin.Article" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>


<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
    <title>Quản lí tin tức</title>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <li><a href="ArticleAdd.aspx" class="report">Thêm mới tin tức</a></li>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!--
        set tab active here
     -->
    <script type="text/javascript" language="javascript">
        setTab(document.getElementById("4"));
    </script>
    <!--
        end set tab active
     -->
     <div id="box">
         <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <h3>Quản lí tin tức</h3>
     
        <telerik:RadGrid ID="rgrArticle" runat="server" AllowFilteringByColumn="True" 
             AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
             DataSourceID="ObjectDataSource1" Skin="Default">
        
                <MasterTableView CellSpacing="-1" DataKeyNames="ArticleID" DataSourceID="ObjectDataSource1">   

                    <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>

                    <ExpandCollapseColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>

                    <Columns>
                        <telerik:GridBoundColumn DataField="ArticleDateCreated" 
                            DataType="System.DateTime" HeaderText="Ngày tạo" 
                            SortExpression="ArticleDateCreated" UniqueName="ArticleDateCreated">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ArticleTitle" HeaderText="Tiêu đề" 
                            SortExpression="ArticleTitle" UniqueName="ArticleTitle">
                        </telerik:GridBoundColumn>
                        
                        <telerik:GridTemplateColumn UniqueName="TemplateColumnDesc" DataField="ArticleDescription"
                            HeaderText="Mô tả" SortExpression="ArticleDescription" AllowFiltering="False">
                            <ItemTemplate>
                                <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("ArticleDescription") %>' 
                                OnDataBinding="lblDescription_DataBinding"></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        
                        <telerik:GridTemplateColumn DataField="ArticleStatus" DataType="System.Int32" 
                            HeaderText="Trạng thái" SortExpression="ArticleStatus" 
                            UniqueName="ArticleStatus">
                            <EditItemTemplate>
                                <asp:TextBox ID="ArticleStatusTextBox" runat="server" 
                                    Text='<%# Bind("ArticleStatus") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="ArticleStatusLabel" runat="server" 
                                    ondatabinding="ArticleStatusLabel_DataBinding" 
                                    Text='<%# Eval("ArticleStatus") %>'></asp:Label>
                            </ItemTemplate>
                            <FilterTemplate>
                                <asp:DropDownList ID="cbbStatus" runat="server" 
                                    AutoPostBack="true" OnPreRender="cbbStatus_PreRender"
                                    OnSelectedIndexChanged="cbbStatus_SelectedIndexChanged" >
                                    <asp:ListItem Text="Tất cả" Value="-1"></asp:ListItem>
                                    <asp:ListItem Text="Hoạt động" Value="1"></asp:ListItem>
                                    <asp:ListItem Text="Khóa" Value="0"></asp:ListItem>
                                </asp:DropDownList>
                            </FilterTemplate>
                        </telerik:GridTemplateColumn>
                        
                        <telerik:GridTemplateColumn UniqueName="TemplateColumn" AllowFiltering="False">
                            <ItemTemplate>
                                <asp:HyperLink ID="HyperLink1" runat="server" 
                                NavigateUrl='<%# Eval("ArticleID", "ArticleEdit.aspx?ArticleID={0}") %>'>Xem</asp:HyperLink>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>                                        
                    </Columns>    
                </MasterTableView>
        
        </telerik:RadGrid>
        
        <asp:Label ID="lblSelectedIndex" runat="server" Text="-1" Visible="False"></asp:Label>   
         <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
             OldValuesParameterFormatString="original_{0}" 
             SelectMethod="Get_tbl_Article_Select_All" 
             TypeName="ProjectSem40701.Admin.AdminXSD.ArticleTableAdapters.tbl_ArticleTableAdapter">
         </asp:ObjectDataSource>
     </div> 
</asp:Content>
